package banco;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.swing.JOptionPane;
import util.Constants;

public class ConnectionDB {

    public Connection getConnection() {
        try {
            return DriverManager.getConnection(Constants.URL_BANCO, Constants.NOME_USUARIO, Constants.SENHA);
        } catch (SQLException sQLException) {
            JOptionPane.showMessageDialog(null, "Erro ao conectar com o banco de dados!\n"
                    + sQLException.getMessage());
            System.exit(1);

            throw new RuntimeException(sQLException);
        }
    }
}
